package ua.eug.land3;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;

public class HexTile {
	private float[] vertices;
    private static final short[] Triangles = new short[]
        {
	        1,2,6,
	        2,3,6,
	        3,4,6,
	        4,5,6,
	        5,0,6,
	        0,1,6
	    };
    
    public Mesh mesh;
        
    public HexTile() {
    	
        vertices = new float[]
        {
            -1f, -.5f, 0f, 0,0,1f, Color.toFloatBits(255, 128, 128, 255),
            -1f,  .5f, 0f, 0,0,1f, Color.toFloatBits(255, 0, 255, 255),
            0f,    1f, 0f, 0,0,1f, Color.toFloatBits(255, 255, 0, 255),
            1f,   .5f, 0f, 0,0,1f, Color.toFloatBits(0, 255, 255, 255),
            1f,  -.5f, 0f, 0,0,1f, Color.toFloatBits(128, 255, 255, 255),
            0f,   -1f, 0f, 0,0,1f, Color.toFloatBits(0, 128, 255, 255),
            0f,    0f,-1f, 0,0,1f, Color.toFloatBits(128, 128, 255, 255)
        };

        mesh = new Mesh(false, 7, 18, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE)
        		,new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE)
        		,new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE)
        		);
               
        mesh.setVertices(vertices);
        mesh.setIndices(Triangles);

    }
}
